package com.htc.utils;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.view.WindowManager.BadTokenException;

public class CommonActions {
	Typeface champagne_Limousines;
	Typeface champagne_Limousines_Bold;
	Activity currentActivity;
	Typeface maft;
	ProgressDialog myProgressDialog;
	Typeface railway_Light;
	Typeface railway_Regular;
	Typeface railway_SemiBold;
	Typeface trebuchet_MS;
	Typeface trebuchet_MS_Bold;

	public CommonActions(Activity paramActivity) {
		this.currentActivity = paramActivity;
		this.trebuchet_MS_Bold = Typeface.createFromAsset(
				this.currentActivity.getAssets(), "Trebuchet_MS_Bold.ttf");
		this.trebuchet_MS = Typeface.createFromAsset(
				this.currentActivity.getAssets(), "Trebuchet_MS.ttf");
		this.champagne_Limousines = Typeface.createFromAsset(
				this.currentActivity.getAssets(), "Champagne_Limousines.ttf");
		this.champagne_Limousines_Bold = Typeface.createFromAsset(
				this.currentActivity.getAssets(),
				"Champagne_Limousines_Bold.ttf");
		this.railway_Regular = Typeface.createFromAsset(
				this.currentActivity.getAssets(), "Raleway_Regular.ttf");
		this.railway_Light = Typeface.createFromAsset(
				this.currentActivity.getAssets(), "Raleway_Light.ttf");
		this.railway_SemiBold = Typeface.createFromAsset(
				this.currentActivity.getAssets(), "Raleway_SemiBold.ttf");
		this.maft = Typeface.createFromAsset(this.currentActivity.getAssets(),
				"MAFT____.TTF");
	}

	public CommonActions(Context paramContext) {
		this.currentActivity = ((Activity) paramContext);
		this.trebuchet_MS_Bold = Typeface.createFromAsset(
				this.currentActivity.getAssets(), "Trebuchet_MS_Bold.ttf");
		this.trebuchet_MS = Typeface.createFromAsset(
				this.currentActivity.getAssets(), "Trebuchet_MS.ttf");
		this.champagne_Limousines = Typeface.createFromAsset(
				this.currentActivity.getAssets(), "Champagne_Limousines.ttf");
		this.champagne_Limousines_Bold = Typeface.createFromAsset(
				this.currentActivity.getAssets(),
				"Champagne_Limousines_Bold.ttf");
		this.railway_Regular = Typeface.createFromAsset(
				this.currentActivity.getAssets(), "Raleway_Regular.ttf");
		this.railway_Light = Typeface.createFromAsset(
				this.currentActivity.getAssets(), "Raleway_Light.ttf");
		this.railway_SemiBold = Typeface.createFromAsset(
				this.currentActivity.getAssets(), "Raleway_SemiBold.ttf");
		this.maft = Typeface.createFromAsset(this.currentActivity.getAssets(),
				"MAFT____.TTF");
	}

	public void clearAllPreferences() {
		SharedPreferences.Editor localEditor = this.currentActivity
				.getSharedPreferences("dlc_preferences", 0).edit();
		localEditor.clear();
		localEditor.commit();
	}

	public Typeface getChampagne_Limousines() {
		return this.champagne_Limousines;
	}

	public Typeface getChampagne_Limousines_Bold() {
		return this.champagne_Limousines_Bold;
	}

	public Typeface getMaft() {
		return this.maft;
	}

	public Typeface getRailway_Light() {
		return this.railway_Light;
	}

	public Typeface getRailway_Regular() {
		return this.railway_Regular;
	}

	public Typeface getRailway_SemiBold() {
		return this.railway_SemiBold;
	}

	public Typeface getTrebuchet_MS() {
		return this.trebuchet_MS;
	}

	public Typeface getTrebuchet_MS_Bold() {
		return this.trebuchet_MS_Bold;
	}

	public Boolean getValueBoolean(String paramString, boolean paramBoolean) {
		return Boolean.valueOf(this.currentActivity.getSharedPreferences(
				"dlc_preferences", 0).getBoolean(paramString, paramBoolean));
	}

	public int getValueInt(String paramString, int paramInt) {
		return this.currentActivity.getSharedPreferences("dlc_preferences", 0)
				.getInt(paramString, paramInt);
	}

	public String getValueString(String paramString1, String paramString2) {
		return this.currentActivity.getSharedPreferences("dlc_preferences", 0)
				.getString(paramString1, paramString2);
	}

	public boolean hasConnection() {
		try {
			ConnectivityManager localConnectivityManager = (ConnectivityManager) this.currentActivity
					.getSystemService("connectivity");
			NetworkInfo localNetworkInfo1 = localConnectivityManager
					.getNetworkInfo(1);
			if ((localNetworkInfo1 != null)
					&& (localNetworkInfo1.isConnected()))
				return true;
			NetworkInfo localNetworkInfo2 = localConnectivityManager
					.getNetworkInfo(0);
			if ((localNetworkInfo2 == null)
					|| (!localNetworkInfo2.isConnected())) {
				NetworkInfo localNetworkInfo3 = localConnectivityManager
						.getActiveNetworkInfo();
				if (localNetworkInfo3 != null) {
					boolean bool = localNetworkInfo3.isConnected();
					if (bool)
						;
				} else {
					label75: return false;
				}
			}
		} catch (Exception localException) {

		}
		return true;
	}

	public void hideProgress() {
		if (this.myProgressDialog != null)
			this.myProgressDialog.dismiss();
	}

	public void savePreferences(String paramString, int paramInt) {
		SharedPreferences.Editor localEditor = this.currentActivity
				.getSharedPreferences("dlc_preferences", 0).edit();
		localEditor.putInt(paramString, paramInt);
		localEditor.commit();
	}

	public void savePreferences(String paramString, boolean paramBoolean) {
		SharedPreferences.Editor localEditor = this.currentActivity
				.getSharedPreferences("dlc_preferences", 0).edit();
		localEditor.putBoolean(paramString, paramBoolean);
		localEditor.commit();
	}

	public void saveUserPreferences(String paramString1, String paramString2) {
		SharedPreferences.Editor localEditor = this.currentActivity
				.getSharedPreferences("dlc_preferences", 0).edit();
		localEditor.putString(paramString1, paramString2);
		localEditor.commit();
	}

	public void setChampagne_Limousines(Typeface paramTypeface) {
		this.champagne_Limousines = paramTypeface;
	}

	public void setChampagne_Limousines_Bold(Typeface paramTypeface) {
		this.champagne_Limousines_Bold = paramTypeface;
	}

	public void setMaft(Typeface paramTypeface) {
		this.maft = paramTypeface;
	}

	public void setRailway_Light(Typeface paramTypeface) {
		this.railway_Light = paramTypeface;
	}

	public void setRailway_Regular(Typeface paramTypeface) {
		this.railway_Regular = paramTypeface;
	}

	public void setRailway_SemiBold(Typeface paramTypeface) {
		this.railway_SemiBold = paramTypeface;
	}

	public void showProgress() {
		try {
			this.myProgressDialog = ProgressDialog.show(this.currentActivity,
					null,
					this.currentActivity.getResources().getString(2131427386),
					true);
			return;
		} catch (Exception localException) {
			return;
		}
	}

	public void showProgress(String paramString) {
		try {
			this.myProgressDialog = ProgressDialog.show(this.currentActivity,
					null, paramString, true);
			return;
		} catch (Exception localException) {
			return;
		}
	}
}
